package com.ruoyi.smart.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class DeviceStatusInitializer {

    private final DeviceStatusService deviceStatusService;

    public DeviceStatusInitializer(DeviceStatusService deviceStatusService) {
        this.deviceStatusService = deviceStatusService;
    }

    /**
     * 应用启动时初始化设备状态
     */
    @EventListener(ApplicationReadyEvent.class)
    public void initializeDeviceStatus() {
        log.info("初始化设备状态...");
        // 这里可以添加从其他系统或数据库加载设备状态的逻辑
        // 例如，从数据库加载所有设备，并将它们初始化为离线状态
        log.info("设备状态初始化完成");
    }
}
